<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="referrer" content="never">
    <link rel="stylesheet" href="../css/base.css">
    <link rel="stylesheet" href="../css/animate.css">
    <script src="../js/common.js"></script>
    <script src="../js/vue.js"></script>
    <script src="../js/jquery.js"></script>
    <link rel="import" href="../vue-component/navBar.html">
    <!-- <link rel="import" href="../vue-component/film-item.html"> -->
    <link rel="import" href="../vue-component/film-list.html">
    <link rel="import" href="../vue-component/film-comments.html">
    <link rel="import" href="../vue-component/bottomBar.html">
    <link rel="import" href="../pages/homes.html">
    <link rel="import" href="../pages/films.html">
    <link rel="import" href="../pages/filmDetails.html">
    <!-- 火狐浏览器不兼容此方法 -->
    <title>电影首页</title>
    <script>
        // console.log(navBar);
        Vue.component("navBar", navBar);
        // Vue.component("filmItem",filmItem);
        Vue.component("filmList", filmList);
    </script>
    <script>
        window.onload = function () {
            new Vue({
                el: ".app",
                components: {
                    bottomBar,
                    Home,
                    Film,
                    FilmDetail
                },
                data: {
                    page: "Home",
                    filmId:0
                },
                methods: {
                    getPage(arg) {
                        this.page = arg;
                    }
                },
                beforeMount() {
                    this.$on("update:detail", (arg, page) => {
                        this.page = page;
                        this.filmId = arg;
                    });
                    console.log(this);
                },
            })
        }
    </script>
</head>

<body>
    <!--  项目容器  -->
    <div class="app">
        <!-- 电影搜索栏 -->
        <nav-bar></nav-bar>
        <!-- 首页正文 -->
        <div class="content-box">
            <transition enter-active-class="animated fadeInRight" leave-active-class="animated fadeOutLeft">
                <keep-alive>
                    <component :is="page" @update:page="getPage"></component>
                </keep-alive>
            </transition>
        </div>
        <!-- 评论区 -->
        <transition enter-active-class="animated fadeInRight" leave-active-class="animated fadeOutLeft">
            <bottom-bar v-show="page=='FilmDetail'"></bottom-bar>      
        </transition>
    </div>
</body>

</html>